#!/bin/bash

params__block_length=$1 #in seconds
params__smooth_window=$2 #in frames
output_folder=$3
params__test_session=$4

params__C_MS=0.3
params__C_FA=0.7

#Input/Output folders
params__database_folder='/home/anna/Hospital/Databases/1_SCDB'
params__reference_folder='/home/anna/Hospital/Segmentation/Alarms_detection/RBMLIB/test/'

params__result_folder="${output_folder}${params__test_session}"

params__p=-10
python Smooth_decision_correct.py ${params__result_folder} ${params__p} ${params__smooth_window}
python Merge_recognizer_labels.py ${params__result_folder} ${params__p}


#Block-based metric calculation
python Get_evaluation_interval_stats_last.py ${params__block_length} ${params__database_folder} ${params__reference_folder}

python Create_labels.py ${params__block_length}

# Use one only one of these two. Last one includes last interval stats.
#python Create_gmmoutput_labels.py ${params__block_length} ${params__experiment_name}
python Create_gmmoutput_labels_last.py ${params__block_length} ${output_folder} ${params__test_session}

python Compare_labels.py ${params__block_length} ${output_folder} ${params__reference_folder} ${params__test_session} ${params__C_MS} ${params__C_FA}


#Frame-based metric calculation
params__lab_file="/home/anna/work/Hospital/Segmentation/Alarms_detection/Code_bash/data/lab/1_SCDB_31.mlf"
python Get_frame_based_scores_fa.py ${params__result_folder} ${params__p} ${params__lab_file}
